import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/social',
    },
    {
      path: '/userEdit',
      component: () => import('../views/userEdit.vue'),
      meta: { title: '个人信息' },
    },
    {
      path: '/social',
      component: () => import('../views/SocialView.vue'),
      meta: { title: '关注/粉丝' },
    },
    {
      path: '/nickName',
      component: () => import('../views/nickName.vue'),
      meta: { title: '编辑昵称' },
    },
    {
      path: '/intro',
      component: () => import('../views/intro.vue'),
      meta: { title: '编辑简介' },
    },
  ],
})
router.afterEach((to) => {
  document.title = to.meta.title as string
})
export default router
